<template>
	<div class="sec-top">
		<a v-link="{path: '/'}" class="btn btn-sm btn-primary">返回活动</a>
		<button class="btn btn-sm btn-primary" @click="addPrize()">新增奖品</button>
	</div>
	<table class="table table-bordered table-hover">
		<caption>活动id:&nbsp;&nbsp;{{currentId}},&nbsp;&nbsp;活动名称:&nbsp;&nbsp;{{currentName}}</caption>
		<thead>
			<tr>
				<th class="col-sm-2">奖品名称</th>
				<th class="col-sm-2">奖品图片</th>
				<th class="col-sm-1">预设总数</th>
				<th class="col-sm-1">发出数量</th>
				<th class="col-sm-1">中奖几率</th>
				<th class="col-sm-1">奖品类型</th>
				<th class="col-sm-1">种子数/价值</th>
				<th class="col-sm-1">奖品状态</th>
				<th class="col-sm-2"></th>
			</tr>
		</thead>
		<tbody>
			<tr v-for="prize in pList">
				<td>{{prize.name}}</td>
				<td><img class="prize-list-pic" :src="prize.pic"></td>
				<td>{{prize.totalNum}}</td>
				<td>{{prize.sendNum}}</td>
				<td>{{prize.rate}}</td>
				<td>{{+prize.type | CustomType}}</td>
				<td>{{prize.seedNum}}</td>
				<td class="text-center">{{prize.status | PrizeStatus}}</td>
				<td class="text-right">
					<button class="btn btn-sm btn-primary"  @click="updatePrize(prize)">修改奖品</button>
					<button class="btn btn-sm btn-primary" v-if="+prize.type === 2" @click="checkCodeList(prize.id, prize.name)">查看兑换码
					</button>
				</td>
			</tr>
		</tbody>
	</table>
	<vue-pages :pages.sync="pages" :get-list="getList"></vue-pages>
	<vue-mini-prize :title="prizeConfigTitle" :show-mini-prize-modal.sync="showMiniPrizeModal" :prize="prizeEx">
	</vue-mini-prize>
</template>
<style src="./prize-list.css" scoped></style>
<script src="./prize-list.js"></script>
